#include <iostream>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    long long m[21] = {0};
    int n, i;
    m[1] = 3;
    m[2] = 7;
    m[3] = 17;
    for (i = 4; i < 21; i++)
    {
        m[i] = 3 * m[i - 2] + 2 * (m[i - 1] - m[i - 2]);
    }
    cin >> n;
    while (n--)
    {
        cin >> i;
        cout << m[i] << endl;
    }
    return 0;
}